package com.medranocg.gd.command

@grails.validation.Validateable
class BuscarClienteCommand {

	String tipoPersona
	String buscarPor
	String valor

	static constraints = {
		valor blank: true,
				nullable: true,
				validator: { val, obj ->
					if (!val) return ['vacio']
					else if (obj.buscarPor != 'nombre' && !val.isLong()) return ['notANumber']
					else if (obj.buscarPor == 'nombre' && val.length() < 5) return ['lt5chars']
				}
	}

}
